package org.okcjug.december.set.objects;

import java.math.BigDecimal;

public class XmasTree implements Comparable<XmasTree>
{
	private String type;
	private int heightInInches;
	private boolean baseIncluded;
	private boolean lightsIncluded;
	private boolean frocked;
	private BigDecimal price;
	
	public XmasTree(){}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public int getHeightInInches() {
		return heightInInches;
	}

	public void setHeightInInches(int heightInInches) {
		this.heightInInches = heightInInches;
	}

	public boolean isBaseIncluded() {
		return baseIncluded;
	}

	public void setBaseIncluded(boolean baseIncluded) {
		this.baseIncluded = baseIncluded;
	}

	public boolean isLightsIncluded() {
		return lightsIncluded;
	}

	public void setLightsIncluded(boolean lightsIncluded) {
		this.lightsIncluded = lightsIncluded;
	}

	public boolean isFrocked() {
		return frocked;
	}

	public void setFrocked(boolean frocked) {
		this.frocked = frocked;
	}

	public BigDecimal getPrice() {
		return price;
	}

	public void setPrice(BigDecimal price) {
		this.price = price;
	}
	
	public String toString()
	{
		return  "Tree: " + getType() 
			+ ", " + getHeightInInches()
			+ ", " + isBaseIncluded()
			+ ", " + isFrocked()
			+ ", " + isLightsIncluded()
			+ ", " + getPrice().toPlainString();
	}
	public String toStringDescriptive()
	{
		return  "Type:    " + getType() 
			+ "\nHeight:  " + getHeightInInches()
			+ "\nBase:    " + isBaseIncluded()
			+ "\nFrocked: " + isFrocked()
			+ "\nLights:  " + isLightsIncluded()
			+ "\nPrice:   " + getPrice().toPlainString();
	}
	
	@Override
	public int compareTo(XmasTree that) 
	{
		if(!this.getType().equals(that.getType())){
			return getType().compareTo(that.getType());
		}
		if(this.getHeightInInches() != that.getHeightInInches()){
			return this.getHeightInInches() - that.getHeightInInches();
		}			
		return this.getPrice().compareTo(that.getPrice());
	}

//	@Override
//	public int hashCode() {
//		final int prime = 31;
//		int result = 1;
//		result = prime * result + ((type == null) ? 0 : type.hashCode());
//		result = prime * result + heightInInches;
//		result = prime * result + ((price == null) ? 0 : price.hashCode());
//		return result;
//	}
//
//	@Override
//	public boolean equals(Object obj) {
//		if (this == obj)
//			return true;
//		if (obj == null)
//			return false;
//		if (getClass() != obj.getClass())
//			return false;
//		final XmasTree other = (XmasTree) obj;
//		if (type == null) {
//			if (other.type != null)
//				return false;
//		} else if (!type.equals(other.type))
//			return false;
//		if (price == null) {
//			if (other.price != null)
//				return false;
//		} else if (!price.equals(other.price))
//			return false;
//		if (heightInInches != other.heightInInches)
//			return false;
//		return true;
//	}
}
